package com.lucy.nepu.data.workload.entity;

import com.lucy.common.core.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * @author kindear
 * 工作量记录表
 */
@Getter
@Setter
@ToString
@RequiredArgsConstructor
@Entity
@Table(name = "nepu_workload")
@ApiModel(value = "工作量记录表")
public class Workload extends BaseEntity implements Serializable {
    /**
     * 工作量附加信息
     */
    @ApiModelProperty(value = "工作量记录附加信息",notes = "JsonObject -> Str")
    @Column(name = "workload_attach")
    String workloadAttach;

    @ApiModelProperty(value = "关联ID")
    @Column(name = "link_Id")
    String linkId;

    @ApiModelProperty(value = "工作量类型",notes = "科研工作量，教学工作量，管理工作量，兼职工作量")
    @Column(name = "workload_type")
    String workloadType;
    /**
     * 工作量来源统计
     */
    @ApiModelProperty(value = "工作量来源",notes = "负责人分配,管理员分配,申请获得")
    @Column(name = "workload_source")
    String workloadSource;

    /**
     * 工作量级别
     */
    @ApiModelProperty(value = "工作量级别",notes = "科研工作量专属字段，其余为缺省值*")
    @Column(name = "workload_level")
    String workloadLevel;

    /**
     * 工作量归属周期ID
     */
    @ApiModelProperty("周期ID")
    @Column(name = "period_id")
    String periodId;

    /**
     * 工作量归属父周期ID
     */
    @ApiModelProperty(value = "父周期ID")
    @Column(name = "perant_period_id")
    String parentPeriodId;

    /**
     * 对应用户ID
     */
    @ApiModelProperty(value = "用户ID",notes = "对应 system-user 表 ID")
    @Column(name = "user_id")
    Long userId;


    @ApiModelProperty(value = "工作量",notes = "")
    @Column(name = "workload",scale = 2)
    Double workload;

    @ApiModelProperty(value = "已使用工作量",notes = "")
    @Column(name = "used_workload",scale = 2)
    Double usedWorkload;

    @ApiModelProperty(value = "用尽标识",notes = "1 为 用尽，0为有剩余")
    @Column(name = "used_up")
    Integer usedUp;

    /**
     * 3 : 可以分配 可以冲抵 可以转化
     * 2 : 可以分配 可以冲抵
     * 1 : 可以抵扣
     * 0 : 禁止任何查询之外的操作
     */
    @ApiModelProperty(value = "锁等级",notes = "0 ~ 3")
    @Column(name = "workload_lock")
    Integer workloadLock;

    @ApiModelProperty(value = "备注信息",notes = "")
    @Column(name = "remark")
    String remark;

}
